﻿using Ledict.ConditionExtract.Common;
using Ledict.ConditionExtract.Model;
using Ledict.Core.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ledict.ConditionExtract.DAL
{
    public class dispute_infoDAL
    {
        MySqlHelper mySql = new MySqlHelper();

        private string DbName;
        public dispute_infoDAL()
        {
            DbName = "disputeinfo";
        }

        /// <summary>
        /// 获取实例数据
        /// </summary>
        /// <param name="ccid">节点信息</param>
        /// <returns></returns>
        public DataTable GetDisputeInfoData(string caseCause, string condition, int startRowIndex, int endRowIndex)
        {
            string sql = " select *from( select ID,DISPUTE_CONTENT from dispute_info where DISPUTE_CaseCause like '" + caseCause + "_%'" + condition + "LIMIT " + startRowIndex + "," + endRowIndex + ")a ORDER BY ID ";
            DataTable dt = mySql.ExecuteDataTable(sql);
            return dt;
        }

        /// <summary>
        /// 获取实例数据总数
        /// </summary>
        /// <param name="caseCause"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public int GetCount(string caseCause, string condition)
        {
            string sql = "  select count(1) from dispute_info where DISPUTE_CaseCause like '%" + caseCause + "%'" + condition;
            return Convert.ToInt32(mySql.ExecuteScalar(sql));
        }

    }
}
